<%--
  Created by IntelliJ IDEA.
  User: zyh
  Date: 2021/11/20
  Time: 9:41
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"
      integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"
        integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fm" uri="http://java.sun.com/jsp/jstl/fmt" %>
<style>
    th{
        text-align: center;
    }
</style>
<html>
<head>
    <title>Title</title>
</head>
<body>
<div class="container">
    <div class="row">
        <div class="col-md-10 col-md-offset-1">
            <form id="addform" method="post">
                <table class="table table-bordered table-hover table-striped" style="text-align: center">
                    <tr class="active">
                        <th colspan="2" >更新电子文档
                            <input type="hidden" value="${edoc.categoryId}" name="categoryId">
                        </th>
                    </tr>
                    <tr class="success">
                        <td>文档编号</td>
                        <td><input type="hidden" value="${edoc.id}" name="id">${edoc.id}</td>
                    </tr>
                    <tr class="success">
                        <td>文档名称</td>
                        <td><input type="text" value="${edoc.title}" name="title" class="form-control"></td>
                    </tr>
                    <tr class="danger">
                        <td>文档摘要</td>
                        <td><input type="text" value="${edoc.summary}" name="summary" class="form-control"></td>
                    </tr>
                    <tr class="warning">
                        <td>上传人</td>
                        <td><input type="text" value="${edoc.uploaduser}" name="uploaduser" class="form-control"></td>
                    </tr>
                    <tr class="info">
                        <td>上传日期</td>
                        <td><input type="date" value="${edoc.createdate}" name="createdate" class="form-control"></td>
                    </tr>
                    <tr class="active">
                        <td colspan="2"><button type="button" class="btn btn-success">提交</button> <a href="${ctx}/entry/index" class="btn btn-success">返回</a></td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
</div>
<script>
    $(function () {
        $(".btn").click(function () {
            let a = $("#addform").serialize();
            alert(a);
            $.ajax({
                url:"${ctx}/entry/updaEntry",
                data:a,
                success:function () {
                    location.href="${ctx}/entry/index";
                }
            })
        })
    })
</script>
</body>
</html>
